#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using tl = tuple < int, int, int >;
using vec = vector < int >;
using veg = vector < pii >;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 10010;

ll a[N], ans = 1e18;
int n;

ll solve() {
	ll mx = -2e9, mn = 2e9;
	rep(i, 1, n) {
		mx = max(mx, a[i] + a[n - i + 1]);
		mn = min(mn, a[i] + a[n - i + 1]);
	} return mx - mn;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	n = in;
	rep(i, 1, n) a[i] = in;
	sort(a + 1, a + n + 1, greater < ll >());
	int lim = n; if(n & 1) n++; inplace_merge(a + 1, a + n, a + n + 1, greater< ll >());
	while(n <= lim * 2) {
		ans = min(ans, solve()); n += 2;  inplace_merge(a + 1, a + n - 1, a + n + 1, greater < ll >());
	} printf("%lld\n", ans);
	return 0;
}
